#ifndef __CHANNEL_HPP__
#define __CHANNEL_HPP__


#include<iostream>
#include<string>
#include<unistd.h>
class Channel
{
        public:
                Channel(int wfd, pid_t who):_wfd(wfd),_who(who)
                {
                        _name = "Channel-" +to_string(wfd)+"--" + to_string(who);
                }
                ~Channel()
                {}
                string Name()
                {
                        return _name;
                }
                void Send(int cmd)
                {
                        ::write(_wfd,&cmd,sizeof(cmd));

                }
		
		int wfd()
		{
			return _wfd;
		}

                void Close()
                {
                        ::close(_wfd);
                }
                pid_t ID()
                {
                        return _who;
                }
        private:
                int _wfd;
                pid_t _who;
                string _name;

};

#endif
